package com.education.wisdom.service.impl;

import com.education.common.utils.Convert;
import com.education.wisdom.mapper.TeacherWorkMapper;
import com.education.wisdom.pojo.TeacherWork;
import com.education.wisdom.service.ITeacherWorkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 教师发布作业 服务层实现
 *
 * @author ruoyi
 * @date 2019-06-20
 */
@Service
public class TeacherWorkServiceImpl implements ITeacherWorkService {
    @Autowired
    private TeacherWorkMapper teacherWorkMapper;

    /**
     * 查询教师发布作业信息
     *
     * @param id 教师发布作业ID
     * @return 教师发布作业信息
     */
    @Override
    public TeacherWork selectTeacherWorkById(Integer id) {
        return teacherWorkMapper.selectTeacherWorkById(id);
    }

    /**
     * 查询教师发布作业列表
     *
     * @param teacherWork 教师发布作业信息
     * @return 教师发布作业集合
     */
    @Override
    public List<TeacherWork> selectTeacherWorkList(TeacherWork teacherWork) {
        return teacherWorkMapper.selectTeacherWorkList(teacherWork);
    }

    /**
     * 新增教师发布作业
     *
     * @param teacherWork 教师发布作业信息
     * @return 结果
     */
    @Override
    public int insertTeacherWork(TeacherWork teacherWork) {
        return teacherWorkMapper.insertTeacherWork(teacherWork);
    }

    /**
     * 修改教师发布作业
     *
     * @param teacherWork 教师发布作业信息
     * @return 结果
     */
    @Override
    public int updateTeacherWork(TeacherWork teacherWork) {
        return teacherWorkMapper.updateTeacherWork(teacherWork);
    }

    /**
     * 删除教师发布作业对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTeacherWorkByIds(String ids) {
        return teacherWorkMapper.deleteTeacherWorkByIds(Convert.toStrArray(ids));
    }

    @Override
    public List<String> selectByGrouping(String userId) {
        return teacherWorkMapper.selectByGrouping(userId);
    }

    @Override
    public List<TeacherWork> selectByWordId(String wordId) {
        return teacherWorkMapper.selectByWordId(wordId);
    }

    @Override
    public List<TeacherWork> selectByClassId(Integer classId) {
        return teacherWorkMapper.selectByClassId(classId);
    }

    @Override
    public List<TeacherWork> selectByUserId(String userId) {
        return teacherWorkMapper.selectByUserId(userId);
    }

}
